/*
   FieldVis - A Tool for Visualizing Astrophysical Magnetohydrodynamic Flow
   
   Copyright (C) 2006 - 2008     FieldVis Development Team
  
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
  
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
  
   You should have received a copy of the GNU General Public License along
   with this program; if not, write to the Free Software Foundation, Inc.,
   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
   File     : CubicSplinePolynomial3D.h
   Author   : Blayne Field
   
   Purpose  : Definition file for the CubicSplinePolynomial class
*/

#ifndef CUBIC_SPLINE_POLYNOMIAL_3D_H
#define CUBIC_SPLINE_POLYNOMIAL_3D_H

#include <iostream>
#include "Point.h"
#include "Vector3D.h"


class CubicSplinePolynomial3D
{
public:
   CubicSplinePolynomial3D();
   CubicSplinePolynomial3D(Point p0, Point p1, Vector3D d0, Vector3D d1);

   Point EvaluateAt(float t) const;
   float AverageCurvature() const;

private:
   float xCubic, xQuadratic, xLinear, xConstant;
   float yCubic, yQuadratic, yLinear, yConstant;
   float zCubic, zQuadratic, zLinear, zConstant;

   CubicSplinePolynomial3D Derivative() const;
   void ComputeCoefficients(float *cube, float *quad, float *linr, float *cons,
                            float x0, float x1, float dx0, float dx1);
};

#endif

